package team.bjbls.mrboot.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import springfox.documentation.annotations.ApiIgnore;
import team.bjbls.mrboot.entity.Pic;
import team.bjbls.mrboot.resul.ResponseData;
import team.bjbls.mrboot.resul.ResultCode;
import team.bjbls.mrboot.service.PicService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * (Pic)表控制层
 *
 * @author makejava
 * @since 2021-05-24 17:26:12
 */
@Api(value = "picApi")
@RestController   //==@Controller+@responseBody
@RequestMapping("pic")
public class PicController {
    /**
     * 服务对象
     */
    @Autowired
    private PicService picService;
    //1.实现数据的获取，2.
    @ApiOperation(value="queryByType",notes = "通过图片的类型获取对应的图片列表")
    @ApiImplicitParam(name = "type",value = "图片列表")
    @GetMapping("queryByType/{type}")
    public ResponseData queryPicType(String type){
        return picService.queryByType(type);
    }
}
//
//    /**
//     * 通过主键查询单条数据
//     *
//     * @param id 主键
//     * @return 单条数据
//     */
//    @ApiOperation(value = "selectOne",notes = "根据id获取图片信息")
//    @ApiImplicitParam(name = "id",value = "图片的id",paramType = "integer")
////    @ApiIgnore//忽略接口
//    @GetMapping("id/{id}")
//    public Pic selectOne(@PathVariable Integer id) {
//
//        return this.picService.queryById(id);
//    }
//    //@ApiOperation(value = "selectOne",notes = "根据id获取图片信息")
//    //@ApiImplicitParam(name = "id",value = "图片的id",paramType = "integer")
//    @ApiIgnore//忽略接口
//    @GetMapping("selectType")
//    public Pic selectType(String type) {
//        Integer id=1;
//        return this.picService.queryById(id);
//    }
//    @ApiImplicitParams(
//            {
//              @ApiImplicitParam(name="uname",value = "用户名"),
//              @ApiImplicitParam(name="tel",value = "电话号码")
//            }
//    )
//    @PostMapping("insert")
//    public Pic insert(String uname,String tel){
//        Integer id  = 1;
//        return this.picService.queryById(id);
//
//    }
//
//}
/**
 * restful 是一个接口设计风格，再特定情况下可以不按照这种风格进行设计
 * id name password ==>
 * GET     执行的是查询操作  @GetMapping   http://localhost:8080/pic/selectOne/1/song
 * POST    执行的是添加操作  @PostMapping
 * DELETE  执行的是删除操作  @DeleteMapping
 * PUT     执行的是修改操作  @PutMapping    update user set name="",password="123" where id=1
 * PATCH   执行的是修改操作  @PatchMapping  update user set password ="123" where = 1
 *
 *
 */
